package com.example.webpractice.vo;


import lombok.Data;

import java.util.List;

/**
 * 分页工具类
 */
@Data
public class PageVo {
    private static final long serialVersionUID = 1L;
    private long total;
    private long pageSize;
    private long totalPage;
    private long currPage;
    private List<?> list;

    /**
     * 分页
     *
     * @param list       列表数据
     * @param totalCount 总记录数
     * @param pageSize   每页记录数
     * @param currPage   当前页数
     */
    public PageVo(List<?> list, long totalCount, long pageSize, long currPage) {
        this.list = list;
        this.total = totalCount;
        this.pageSize = pageSize;
        this.currPage = currPage;
        this.totalPage = (int) Math.ceil((double) totalCount / pageSize);
    }
}
